package cn.hznc.constant;

import cn.hznc.vo.EquipmentTaskVo;
import cn.hznc.vo.SubProgramUsageReportVo;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author：Administrator
 * @Date：2024/1/8 16:16
 */
public enum SortTaskEnum implements SortTask{

    StartTime{
        @Override
        public List<EquipmentTaskVo> sortByCondition(List<EquipmentTaskVo> equipmentTaskVo, Integer sortType) {
            if(sortType == 0){
                //正序
                return equipmentTaskVo
                        .stream()
                        .sorted(Comparator.comparing(EquipmentTaskVo::getStartTime))
                        .collect(Collectors.toList());
            }
            //倒序
            return equipmentTaskVo
                    .stream()
                    .sorted(Comparator.comparing(EquipmentTaskVo::getStartTime).reversed())
                    .collect(Collectors.toList());
        }
    }
}
